/*
========================================================================
 Name        : PublicTransportMapContainerView.h
 Author      : 
 Copyright   : Your copyright notice
 Description : 
========================================================================
*/
#ifndef PUBLICTRANSPORTMAPCONTAINERVIEW_H
#define PUBLICTRANSPORTMAPCONTAINERVIEW_H

// [[[ begin generated region: do not modify [Generated Includes]
#include <aknview.h>
// ]]] end generated region [Generated Includes]

#include "lbsposition.h"
#include "AsyncFileLoader.h"
#include "SingaporeBusStructures.h"

// [[[ begin [Event Handler Includes]
// ]]] end [Event Handler Includes]

// [[[ begin generated region: do not modify [Generated Constants]
// ]]] end generated region [Generated Constants]

// [[[ begin generated region: do not modify [Generated Forward Declarations]
class CPublicTransportMapContainer;
// ]]] end generated region [Generated Forward Declarations]

#include "CSingaporeBusGenericView.h"

/**
 * Avkon view class for PublicTransportMapContainerView. It is register with the view server
 * by the AppUi. It owns the container control.
 * @class	CPublicTransportMapContainerView PublicTransportMapContainerView.h
 */						


class CPublicTransportMapContainerView :
	public CAknView, public CStoreViewState
	{
	
	
	// [[[ begin [Public Section]
public:
	// constructors and destructor
	CPublicTransportMapContainerView();
	static CPublicTransportMapContainerView* NewL();
	static CPublicTransportMapContainerView* NewLC();        
	void ConstructL();
	virtual ~CPublicTransportMapContainerView();

	const TStation* iSelectedStation;
	const TService* iSelectedService;
	RArray<HBufC8*> iDisplayServiceKeys;
	TInt iCurrentDisplayServiceKey;
	RArray<TServicePath> iServicePaths;
	TBool iDisplayRouteSteps;
	void StoreViewStateL(TDes8& aCustomMessage);
	void RestoreViewStateL(const TDesC8& aCustomMessage);

	// from base class CAknView
	TUid Id() const;
	void HandleCommandL( TInt aCommand );
	
	// [[[ begin generated region: do not modify [Generated Methods]
	CPublicTransportMapContainer* CreateContainerL();
	// ]]] end generated region [Generated Methods]
	
	// ]]] end [Public Section]
	void NotifyPositionChange();
	void NotifyAzimuthChange();
	void NotifyFileLoaded(const CAsyncFileLoader* aFile);
	void NotifyConnected();

	TCoordinate iOrig;
	TInt iZoomLevel;
	RArray<const TStation*> iStationsOrderedByLongitude;
	
	
    TVwsViewId iPrevViewId;

	void UpdateTitle();
	void HandleTitlePaneEventL( TInt aEventID );
	void RedrawMap();


	
	struct CViewState : public CBase
		{
		TCoordinate iOrig;
		TInt iZoomLevel;
		const TStation* iSelectedStation;
		const TService* iSelectedService;
		RArray<HBufC8*> iDisplayServiceKeys;
		TInt iCurrentDisplayServiceKey;
		TBool iDisplayRouteSteps;
		RArray<TServicePath> iServicePaths;
		CViewState() { }
		~CViewState() { for(TInt i = 0 ; i < iDisplayServiceKeys.Count() ; ++i) delete iDisplayServiceKeys[i]; iDisplayServiceKeys.Close(); iServicePaths.Close(); }
		};
	CViewState* GetViewStateLC();
	void RestoreViewStateL(CViewState* aViewState);
	CCoeControl* iContainer();
	
	
	// [[[ begin [Protected Section]
protected:
	// from base class CAknView
	void DoActivateL(
		const TVwsViewId& aPrevViewId,
		TUid aCustomMessageId,
		const TDesC8& aCustomMessage );
	void DoDeactivate();
	void HandleStatusPaneSizeChange();
	
	
	// [[[ begin generated region: do not modify [Overridden Methods]
	// ]]] end generated region [Overridden Methods]
	
	
	// [[[ begin [User Handlers]
	TBool HandleConnection_settingsMenuItemSelectedL( TInt aCommand );
	TBool HandleMapMenuItemSelectedL( TInt aCommand );
	TBool HandleShow_busMenuItemSelectedL( TInt aCommand );
	TBool HandleExitMenuItemSelectedL( TInt aCommand );
	TBool HandleControlPaneRightSoftKeyPressedL( TInt aCommand );
	TBool HandleRefresh_positionMenuItemSelectedL( TInt aCommand );
	TBool HandleMarkFavoriteMenuItemSelectedL( TInt aCommand );
	TBool HandleMarkOriginMenuItemSelectedL( TInt aCommand );
	TBool HandleMarkDestinationMenuItemSelectedL( TInt aCommand );
	TBool HandleViewListMenuItemSelectedL( TInt aCommand );
	TBool HandleViewRouteMenuItemSelectedL( TInt aCommand );
	// ]]] end [User Handlers]
	
	// ]]] end [Protected Section]
	
	
	// [[[ begin [Private Section]
private:
	void SetupStatusPaneL();
	void CleanupStatusPane();
	
	// [[[ begin generated region: do not modify [Generated Instance Variables]
	CPublicTransportMapContainer* iPublicTransportMapContainer;
	// ]]] end generated region [Generated Instance Variables]
	
	// [[[ begin generated region: do not modify [Generated Methods]
	// ]]] end generated region [Generated Methods]
	void OverrideSetupStatusPaneL();

	// ]]] end [Private Section]
	
	};

#endif // PUBLICTRANSPORTMAPCONTAINERVIEW_H
